package com.ruoyi.quartz.util;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.http.HttpUtils;
import java.io.IOException;
import okhttp3.OkHttpClient;

public class DailyStockDataUtil {

  private static final String url =
      "http://90.push2.eastmoney.com/api/qt/clist/get?pn=1&pz=10000&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:80,m:1+t:2,m:1+t:23&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152";

  public static JSONObject getBuilder() throws IOException {
    final OkHttpClient defaultHttpClient =
        new OkHttpClient.Builder()
            //                .addInterceptor(new
            // HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.NONE))
            .build();
    okhttp3.Request request = new okhttp3.Request.Builder().url(url).get().build();
    //        Response execute = defaultHttpClient.newCall(request).execute();
    //
    //        String s = HttpUtils.sendGet(url, null);
    return JSONObject.parseObject(HttpUtils.sendGet(url, null, null));
  }

  public static void main(String[] args) throws IOException {
    System.out.println(getBuilder().getJSONObject("data").getJSONArray("diff").get(0));
  }
}
